﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.IBLL;
using HZ.Supervise.Model;
using HZ.Supervise.Model.Enum;
using HZ.Supervise.Model.View; 
using System.Data;

namespace HZ.Supervise.Web.Report
{
    public partial class PurchaseNotNet :BasePage
    {

        public PurchaseNotNet()
        {
            
        }
     
 
        IBLL_Company ic = HZ.Supervise.BLLFactory.IBLL_Company();
        SuperviseQuery vs = new SuperviseQuery();

       

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { 
                BindData(); 
            }
        }

        /// <summary>
       
        /// <summary>
        /// 绑定数据 
        /// </summary>
        public void BindData()
        {
            vs = Queryby(); 
            int t = 0;
            System.Data.DataTable dt = ic.PurchaseNotNetByHospital(vs, this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out t);
            AspNetPager1.RecordCount = t;
            this.gvwInfo.PageSize = AspNetPager1.PageSize;
            this.gvwInfo.DataSource = dt;
            this.gvwInfo.DataBind();

        }
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
        }


        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            BindData();

        }
 

 

        /// <summary>
        /// 导出 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            vs = Queryby();
            int t = 0;
            System.Data.DataTable dt = ic.PurchaseNotNetByHospital(vs, 1,0, out t);
           
            ExportFile.Instance.ExportData(dt, gvwInfo, this.Page);


        }
 

 
        /// <summary>
        /// 查询条件
        /// </summary>
        /// <returns></returns>
        private SuperviseQuery Queryby()
        {
            SuperviseQuery vs = new SuperviseQuery();

            try
            {

                vs = (SuperviseQuery)Session[Request.QueryString["sesid"]];
                vs.HospitalName = txtHospital.Text.Trim();
               
            }
            catch
            {
                
            }

            return vs;
        }


      

    }
}
